<meta args="config"/>
<form s="nda,datac,valid" s-data="config" id="form">
    <table class="table">
        <tr>
            <td style="width: 100px;">关键字</td>
            <td>
                <input autocomplete="off" type="text" name="keyword" class="form-control"/>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">商品ID</td>
            <td>
                <input autocomplete="off" type="text" name="goodsIdList" class="form-control"/>
                <div class="help-block">多个商品id用逗号隔开</div>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">类目</td>
            <td>
                <div class="input-group input-group-sm">
                    <a href="javascript:;" class="input-group-addon" name="catName" id="catName">-</a>
                    <input autocomplete="off" type="text" name="catId" class="form-control catId input-sm" placeholder="">
                    <input autocomplete="off" type="hidden" name="catName" id="catNameInput"/>
                    <a href="javascript:;" class="input-group-addon" s-click="selectGoodsCategory(this)">选择</a>
                </div>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">优惠券</td>
            <td>
                <label class="s-checkbox">
                    <input autocomplete="off" type="checkbox" name="withCoupon" value="true">
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">排序方式</td>
            <td>
                <select name="sortType" class="form-control">
                    <option value="0">综合排序</option>
                    <option value="1">按佣金比率升序</option>
                    <option value="2">按佣金比例降序</option>
                    <option value="3">按价格升序</option>
                    <option value="4">按价格降序</option>
                    <option value="5">按销量升序</option>
                    <option value="6">按销量降序</option>
                    <option value="7">优惠券金额排序升序</option>
                    <option value="8">优惠券金额排序降序</option>
                    <option value="9">券后价升序排序</option>
                    <option value="10">券后价降序排序</option>
                    <option value="11">按照加入多多进宝时间升序</option>
                    <option value="12">按照加入多多进宝时间降序</option>
                    <option value="13">按佣金金额升序排序</option>
                    <option value="14">按佣金金额降序排序</option>
                    <option value="15">店铺描述评分升序</option>
                    <option value="16">店铺描述评分降序</option>
                    <option value="17">店铺物流评分升序</option>
                    <option value="18">店铺物流评分降序</option>
                    <option value="19">店铺服务评分升序</option>
                    <option value="20">店铺服务评分降序</option>
                </select>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">招商多多客ID</td>
            <td class="form-inline">
                <input autocomplete="off" type="text" name="zsDuoId" class="form-control"/>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">店铺类型</td>
            <td class="form-inline">
                <select name="merchantType" class="form-control">
                    <option value="">所有</option>
                    <option value="1">个人</option>
                    <option value="2">企业</option>
                    <option value="3">旗舰店</option>
                    <option value="4">专卖店</option>
                    <option value="5">专营店</option>
                    <option value="5">普通店</option>
                </select>
            </td>
        </tr>
    </table>
</form>

<script>
    S.getConfig = function () {
        var deferred = $.Deferred();
        $form.validate().done(function() {
            deferred.resolve(Smart.serializeToObject($form.node))
        })
        return deferred;
    }
    function selectGoodsCategory($this) {
        S.popupOpen("/pdd/goodsCatSelector.html").done(function(cats) {
            if(cats && cats.length) {
                var cat = cats[0]
                $this.node.parent().find(".catId").val(cat.catId);
                $catName.node.html(cat.catName)
                $catNameInput.node.val(cat.catName)
            }
        })
    }
</script>